Optimal. Leaf size=127 \[ -\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}+\frac {4 a^3 \, _2F_1(1,1+n;2+n;i \tan (e+f x)) (d \tan (e+f x))^{1+n}}{d f (1+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 127, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 26, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.192, Rules used = {3637, 3673,
3618, 12, 66} \begin {gather*} \frac {4 a^3 (d \tan (e+f x))^{n+1} \, _2F_1(1,n+1;n+2;i \tan (e+f x))}{d f (n+1)}-\frac {a^3 (2 n+5) (d \tan (e+f x))^{n+1}}{d f (n+1) (n+2)}-\frac {\left (a^3+i a^3 \tan (e+f x)\right ) (d \tan (e+f x))^{n+1}}{d f (n+2)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 12
Rule 66
Rule 3618
Rule 3637
Rule 3673
Rubi steps
\begin {align*} \int (d \tan (e+f x))^n (a+i a \tan (e+f x))^3 \, dx &=-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}+\frac {a \int (d \tan (e+f x))^n (a+i a \tan (e+f x)) (a d (3+2 n)+i a d (5+2 n) \tan (e+f x)) \, dx}{d (2+n)}\\ &=-\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}+\frac {a \int (d \tan (e+f x))^n \left (4 a^2 d (2+n)+4 i a^2 d (2+n) \tan (e+f x)\right ) \, dx}{d (2+n)}\\ &=-\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}+\frac {\left (16 i a^5 d (2+n)\right ) \text {Subst}\left (\int \frac {4^{-n} \left (-\frac {i x}{a^2 (2+n)}\right )^n}{-16 a^4 d^2 (2+n)^2+4 a^2 d (2+n) x} \, dx,x,4 i a^2 d (2+n) \tan (e+f x)\right )}{f}\\ &=-\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}+\frac {\left (i 4^{2-n} a^5 d (2+n)\right ) \text {Subst}\left (\int \frac {\left (-\frac {i x}{a^2 (2+n)}\right )^n}{-16 a^4 d^2 (2+n)^2+4 a^2 d (2+n) x} \, dx,x,4 i a^2 d (2+n) \tan (e+f x)\right )}{f}\\ &=-\frac {a^3 (5+2 n) (d \tan (e+f x))^{1+n}}{d f (1+n) (2+n)}+\frac {4 a^3 \, _2F_1(1,1+n;2+n;i \tan (e+f x)) (d \tan (e+f x))^{1+n}}{d f (1+n)}-\frac {(d \tan (e+f x))^{1+n} \left (a^3+i a^3 \tan (e+f x)\right )}{d f (2+n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(900\) vs. \(2(127)=254\).
time = 8.29, size = 900, normalized size = 7.09 \begin {gather*} \frac {\cos ^3(e+f x) \left (\frac {\sec ^2(e+f x) (-i \cos (3 e)-\sin (3 e))}{2+n}+\frac {(-3-2 n+\cos (2 e)) \sec ^2(e) \left (-\frac {1}{2} i \cos (3 e)-\frac {1}{2} \sin (3 e)\right )}{(1+n) (2+n)}+\frac {(-\cos (e-f x)+\cos (e+f x)) \sec ^2(e) \sec (e+f x) \left (-\frac {1}{2} i \cos (3 e)-\frac {1}{2} \sin (3 e)\right )}{1+n}\right ) (d \tan (e+f x))^n (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {\cos ^3(e+f x) \left (\frac {\sec ^2(e) (-1+\cos (2 e)+3 i \sin (2 e)) \left (\frac {1}{2} i \cos (3 e)+\frac {1}{2} \sin (3 e)\right )}{1+n}+\frac {\sec ^2(e) \sec (e+f x) \left (\frac {1}{2} i \cos (3 e)+\frac {1}{2} \sin (3 e)\right ) (-\cos (e-f x)+\cos (e+f x)-3 i \sin (e-f x)+3 i \sin (e+f x))}{1+n}\right ) (d \tan (e+f x))^n (a+i a \tan (e+f x))^3}{f (\cos (f x)+i \sin (f x))^3}+\frac {i 2^{2-n} \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^n \cos ^3(e+f x) \left (2^n \, _2F_1\left (1,n;1+n;-\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )-\left (1+e^{2 i (e+f x)}\right )^n \, _2F_1\left (n,n;1+n;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )\right ) \tan ^{-n}(e+f x) (d \tan (e+f x))^n (a+i a \tan (e+f x))^3}{\left (e^{i e}+e^{3 i e}\right ) f n (\cos (f x)+i \sin (f x))^3}-\frac {4 i e^{-3 i e} \left (-1+e^{2 i (e+f x)}\right )^n \left (-\frac {i \left (-1+e^{2 i (e+f x)}\right )}{1+e^{2 i (e+f x)}}\right )^n \left (\frac {-1+e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )^{-n} \cos ^3(e+f x) \left (-\frac {\left (1+e^{2 i (e+f x)}\right )^{-n} \, _2F_1\left (1,n;1+n;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )}{n}-\frac {\left (1+e^{2 i e}\right ) \left (-1+e^{2 i (e+f x)}\right ) \left (1+e^{2 i (e+f x)}\right )^{-1-n} \, _2F_1\left (1,1+n;2+n;\frac {1-e^{2 i (e+f x)}}{1+e^{2 i (e+f x)}}\right )}{1+n}+\frac {2^{-n} \, _2F_1\left (n,n;1+n;\frac {1}{2} \left (1-e^{2 i (e+f x)}\right )\right )}{n}\right ) \tan ^{-n}(e+f x) (d \tan (e+f x))^n (a+i a \tan (e+f x))^3}{\left (1+e^{2 i e}\right ) f (\cos (f x)+i \sin (f x))^3} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 1.03, size = 0, normalized size = 0.00 \[\int \left (d \tan \left (f x +e \right )\right )^{n} \left (a +i a \tan \left (f x +e \right )\right )^{3}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} - i a^{3} \left (\int i \left (d \tan {\left (e + f x \right )}\right )^{n}\, dx + \int \left (- 3 \left (d \tan {\left (e + f x \right )}\right )^{n} \tan {\left (e + f x \right )}\right )\, dx + \int \left (d \tan {\left (e + f x \right )}\right )^{n} \tan ^{3}{\left (e + f x \right )}\, dx + \int \left (- 3 i \left (d \tan {\left (e + f x \right )}\right )^{n} \tan ^{2}{\left (e + f x \right )}\right )\, dx\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int {\left (d\,\mathrm {tan}\left (e+f\,x\right )\right )}^n\,{\left (a+a\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}^3 \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________